$(function () {


    var __global_titleCount = 1;
    $("#addTitle").click(function (titleCount) {
        titleCount = __global_titleCount;
        var titleTemplate = $("#titleTemplate").html();
        $("#content").append(titleTemplate);
        $("#title").attr("id", "title" + titleCount);
        $("#deleteTitle").attr("id", "deleteTitle" + titleCount);
        $("#deleteTitle" + titleCount).click(function () {
            $("#title" + titleCount).remove();
        });
        __global_titleCount += 1;
    });


    var __global_bodyCount = 1;
    $("#addBody").click(function (bodyCount) {
        bodyCount = __global_bodyCount;
        var bodyTemplate = $("#bodyTemplate").html();
        $("#content").append(bodyTemplate);
        $("#body").attr("id", "body" + bodyCount);
        $("#deleteBody").attr("id", "deleteBody" + bodyCount);
        $("#deleteBody" + bodyCount).click(function () {
            $("#body" + bodyCount).remove();
        });
        __global_bodyCount += 1;
    });


    var __global_picCount = 1;
    $("#addPic").click(function (picCount) {
        picCount = __global_picCount;
        var picTemplate = $("#picTemplate").html();
        $("#content").append(picTemplate);
        $("#pic").attr("id", "pic" + picCount);
        $("#picId").attr("id", "picId" + picCount);
        $("#deletePic").attr("id", "deletePic" + picCount);
        $("#deletePic" + picCount).click(function () {
            $("#pic" + picCount).remove();
        });
        __global_picCount += 1;
    });


    var __global_HtmlCount = 1;
    $("#addHtml").click(function (HtmlCount) {
        HtmlCount = __global_HtmlCount;
        var HtmlTemplate = $("#HtmlTemplate").html();
        $("#content").append(HtmlTemplate);
        $("#html").attr("id", "html" + HtmlCount);
        $("#htmlId").attr("id", "htmlId" + HtmlCount);
        $("#deleteHtml").attr("id", "deleteHtml" + HtmlCount);
        $("#deleteHtml" + HtmlCount).click(function () {
            $("#html" + HtmlCount).remove();
        });
        __global_HtmlCount += 1;
    });


    var __global_videoCount = 1;
    $("#addVideo").click(function (videoCount) {
        videoCount = __global_videoCount;
        var videoTemplate = $("#videoTemplate").html();
        $("#content").append(videoTemplate);
        $("#video").attr("id", "video" + videoCount);
        $("#videoId").attr("id", "videoId" + videoCount);
        $("#deleteVideo").attr("id", "deleteVideo" + videoCount);
        $("#deleteVideo" + videoCount).click(function () {
            $("#video" + videoCount).remove();
        });
        __global_videoCount += 1;
    });


})
